package ReviewTest;

import java.util.ArrayList;

public class Test {
    public static void main(String[] args) {
        Person p1 = new Person();
        p1.setName("小秋");
        p1.setHeight(1.72);
        p1.setWeight(72);
        Person p2 = new Person();
        p2.setName("小红");
        p2.setHeight(1.58);
        p2.setWeight(44);
        Person p3 = new Person();
        p3.setName("小白");
        p3.setHeight(1.80);
        p3.setWeight(55);
        ArrayList<Person> list = new ArrayList<>();
        list.add(p1);
        list.add(p2);
        list.add(p3);
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getName().equals("小白")) {
                int weightOld = list.get(i).getWeight();
                list.get(i).setWeight(weightOld+=10);
                list.get(i).showBMI();
            }
        }
    }
}
